<%--
  Created by IntelliJ IDEA.
  User: 步步为莹
  Date: 2019/9/17
  Time: 9:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Beyond车辆管理平台</title>
    <link rel="stylesheet" href="../../../static/css/style.css">
    <link rel="stylesheet" href="../../../static/css/jquery.wysiwyg.old-school.css">
    
    <!-- jQuery AND jQueryUI -->
    <script type="text/javascript" src="../../../static/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../../static/js/jquery-ui.min.js"></script>
    <script type="text/javascript" src="../../../static/js/min.js"></script>
    <!--<script type="text/javascript" src="js/index.js"></script>-->
</head>
<body>
<script type="text/javascript" src="../../../static/js/main.js"></script>
<link rel="stylesheet" href="../../../static/css/style2.css">
<div id="content" class="white" style="margin-left:242px">
    <div class="bloc">
        <div class="title" style="margin-top:40px">新增角色</div>
        <div class="content">
            <form id="modify">
                <div class="input">
                    <label>角色名称:</label>
                    <input type="text" id="role_name" name="role_name">
                    </div>
                <div class="input">
                    <label for="remark">备注:</label>
                    <input type="text" id="remark" name="remark">
                </div>
                <input class="btn btn-danger" type="reset" id="reset" value="重置">
                <span onclick="commit()">提交</span>
            </form>
        
        </div>
    </div>
</div>
<div id="ui-datepicker-div" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>
<script type="text/javascript">
    function commit() {
        var queryStr=$("form#modify").serialize();
        $.ajax({
            url:"<%=request.getContextPath()%>/roleServlet",
            data:"opr=addRole&"+queryStr,
            dataType:"text",
            type:"POST",
            success:function (result) {
                console.log(result);
                if (result==="true"){
                    alert("添加角色成功！");
                    window.location.href="role.jsp";
                }else {
                    alert("添加角色失败！");
                }
            }
        })
    }
</script>

</body>
</html>
